Page({
  data: {
    inputValue: '',
    list: []
  },

  inputHandler(e) {
    this.setData({
      inputValue: e.detail.value
    })
  },

  searchHandler() {
    wx.request({
      url: 'http://rap2api.taobao.org/app/mock/224284/api/v1/pet/search?title=' + this.data.inputValue,
      success: res => {
        console.log(res)
        this.setData({
          list: res.data.data.list
        })
      }
    })
  },

  toDetail(e) {
    console.log(e)
    wx.navigateTo({
      url: '/pages/detail/index?id=' + e.currentTarget.dataset.id
    })
  }
})